home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
gnu
/
gnushogi.lha
/
gnushogi-1.1
/
doc
/
BOOKFILES
next >
Wrap
Text File
|
1993-04-07
|
5KB
|
138 lines
Binary book files
-----------------
In Gnushogi the book file is a binary file.
The primary book file is "gnuchess.book.data". It is intended that text book files will only be
used to generate the binary file (see remarks about syntax below).
The GDX based bookfile is the standard binary bookfile and should be used. This means the -DGDX
compile option should be used and the instructions for generating a GDX book followed. The Makefile
will generate a GDX book for the basic gnushogi.book text file if "make install" is entered or
if "make gnushogi.book.data" is entered. Larger opening databases can be created using the opening
data in the misc directory. If you use other than GDX based books follow the instructions below.
COMPILE TIME
There are two choices for the binary book file at compile time.
Compile option -DGDX creates a random file based book file. It is space efficient
medium fast to generate, and allows large books.
If neither of the above options is choosen the memory based book is generated.
The size of the book is then dependent on the memory you have available.
Creating a Binary book file.
*GDX based.
GDX based creates a disk based hash file. You must specify the size of the file.
It is the most efficient book to use.
gnushogir -b textfile -B binaryfile -S #entries [-P plys]
"#entries" is the number of unique position/move combinations that will be kept plus an extra 20-30%
since this is a hashfile. The size of the file will be:
12 + (#entries)*14
A book with 528k moves which resulted in 319k entries. There can be
multiple entries for a position. I put this in a binary file with space
for 450k entries and it took about 5 meg.
*Memory based.
Memory based bookfiles are produced just like GDX based.
Misc.
You can add entries to an existing binary file. If the binary file exists the entries in the text file
will be added to the binary file.
If possible use a memory based file system when generating a binary book file. It will go much faster.
Syntax of text book files
-------------------------
Text book files are used to generate the binary book file. You must follow a special
text book file syntax while adding an opening line. The book file parser (program that
interpretes the text book moves) is abble to accept several common Shogi notations.
It also allows to include comments.
All characters in a line following a '#' character are comments.
The moves of an opening line is always between two lines with a '#' as its first
character. So, you must not use 1st-column-'#'-comments to give comments to an
opening line. "in-opening" comments are included in brackets ('[' ... ']').
After each ply, you can add a comment in parantheses ('(' ... ')').
This is normally used in Shogi notations to indicate the amount of time used by
the player to enter that move.
There are several possibilites to describe a move. Examples are
7g7f P7f P7g-7f P-7f
3c3d +B3cx3d +Bx3d +B3d
2d2c+ P2c+ P2dx2c+ Px2c+
When you use a character to indicate the piece type, you have to observe
whether the piece is promoted or not, i.e for a promoted piece you have to
indicate this using a '+'. In Shogi notations, the '+' for promoted pieces
may be important in order to avoid ambiguities.
For example
#
# Double Fortess
P7f P8d
[ this is an "in-opening" comment ]
S6h P8e(1)
# this is an "off-opening" comment
defines an opening line with two moves (four plys). The first comment line above an
opening line serves as the name of the opening line. This name is used in case of
errors in the opening line.
You can use move numbers given as a decimal number followed by a '.'.
You can indicate good and bad moves using the character combinations
? ?? ?! ! !! !? !?/?! ?!/!?
They have the same meaning as in chess. The characters must directly follow a move,
i.e. there must be no spaces between the move and the bad/good indicator.
P5e-5d? is correct, while P5e-5d ? is incorrect.
The indicators can be seen as a comment with one exception: if the first character
of the indicator is a '?', the move is marked as BAD_MOVE by the program and it
is not used by the computer if the computer has the option to make this move.
You can add some words which indicate the end of a game. These words are
Resigns Sennichite Jishogi 1-0 0-1
"Sennichite" means "draw by repitition and "Jishogi" means "impasse".
Several text book openings are given in the "misc" directory of this distribution.
Some of them have comments, and it could be very useful to study the comments
in order to improve your play or learn how to play Shogi.
Adding new opening lines
------------------------
You can add opening lines to the binary book file as noted above. Another possibility
is to build a text book file adding this name to the list of text book files in
the src/Makefile. With "make gnushogi.book.data" you can recreate the binary book.
Use "make install" in order to copy the binary book file to its destination.
Request
-------
If you add new opening lines, please make them available to the
GNU Shogi community. Thank you.